﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MovieCollectionManager
{
    public partial class MainForm : Form
    {
        private LoginForm loginForm;

        public MainForm(LoginForm login)
        {
            loginForm = login;
            InitializeComponent();
        }

        private void buttonQuit_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void buttonAddMovie_Click(object sender, EventArgs e)
        {
            CreateAddForm();
        }

        private void buttonSearchMovie_Click(object sender, EventArgs e)
        {
            CreateSearchForm();
        }

        private void buttonListMovies_Click(object sender, EventArgs e)
        {
            CreateListMoviesForm();
        }

        private void buttonEditMovie_Click(object sender, EventArgs e)
        {
            CreateEditMovieForm();
        }
        
        private void buttonRemoveMovie_Click(object sender, EventArgs e)
        {
            CreateRemoveMovieForm();
        }

        private void buttonLendMovie_Click(object sender, EventArgs e)
        {
            CreateLoanForm();
        }

        private void buttonLogoff_Click(object sender, EventArgs e)
        {
            ShowLoginForm();
        }

        private void addMovieToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CreateAddForm();
        }

        private void searchMovieToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CreateSearchForm();
        }

        private void listMoviesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CreateListMoviesForm();
        }

        private void editMovieToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CreateEditMovieForm();
        }

        private void removeMovieToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CreateRemoveMovieForm();
        }

        private void lendMovieToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CreateLoanForm();
        }

        private void logOffToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ShowLoginForm();
        }

        private void quitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void addUserToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CreateUserForm createUserForm = new CreateUserForm();
            createUserForm.ShowDialog();
        }

        private void removeUserToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DeleteUserForm deleteUserForm = new DeleteUserForm();
            deleteUserForm.ShowDialog();
        }

        private void changePasswordToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ChangePasswordForm changePasswordForm = new ChangePasswordForm();
            changePasswordForm.ShowDialog();
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AboutForm aboutForm = new AboutForm();
            aboutForm.ShowDialog();
        }

        private static void CreateAddForm()
        {
            AddForm addForm = new AddForm();
            addForm.ShowDialog();
        }

        private static void CreateSearchForm()
        {
            SearchForm searchForm = new SearchForm();
            searchForm.ShowDialog();
        }

        private static void CreateListMoviesForm()
        {
            ListForm listForm = new ListForm();
            listForm.ShowDialog();
        }

        private static void CreateEditMovieForm()
        {
            EditForm editForm = new EditForm();
            editForm.ShowDialog();
        }

        private static void CreateRemoveMovieForm()
        {
            DeleteForm deleteForm = new DeleteForm();
            deleteForm.ShowDialog();
        }

        private static void CreateLoanForm()
        {
            LoanMainForm loanMainForm = new LoanMainForm();
            loanMainForm.ShowDialog();
        }

        private void ShowLoginForm()
        {
            Hide();
            loginForm.Show();
        }
    }
}
